/*
 * Copyright (C) 2014 Realtek Semiconductor Corp.
 * All Rights Reserved.
 *
 * This program is the proprietary software of Realtek Semiconductor
 * Corporation and/or its licensors, and only be used, duplicated,
 * modified or distributed under the authorized license from Realtek.
 *
 * ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER
 * THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
 *
 * Purpose : Definition of ME handler: Threshold data 2 (274)
 *
 * Feature : The file includes the following modules and sub-modules
 *           (1) ME handler: Threshold data 2 (274)
 */

#include "app_basic.h"


MIB_TABLE_INFO_T gMibThresholdData2TableInfo;
MIB_ATTR_INFO_T  gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_ATTR_NUM];
MIB_TABLE_THRESHOLDDATA2_T gMibThresholdData2DefRow;
MIB_TABLE_OPER_T gMibThresholdData2Oper;


GOS_ERROR_CODE ThresholdData2DrvCfg(void* pOldRow, void* pNewRow, MIB_OPERA_TYPE operationType, MIB_ATTRS_SET attrSet, UINT32 pri)
{
	OMCI_LOG(OMCI_LOG_LEVEL_DBG,"%s: process end\n", __FUNCTION__);
	return GOS_OK;
}

GOS_ERROR_CODE mibTable_init(MIB_TABLE_INDEX tableId)
{
    gMibThresholdData2TableInfo.Name = "ThresholdData2";
    gMibThresholdData2TableInfo.ShortName = "TH2";
    gMibThresholdData2TableInfo.Desc = "Threshold data 2";
    gMibThresholdData2TableInfo.ClassId = (UINT32)(OMCI_ME_CLASS_THRESHOLD_DATA_2);
    gMibThresholdData2TableInfo.InitType = (UINT32)(OMCI_ME_INIT_TYPE_OLT);
    gMibThresholdData2TableInfo.StdType = (UINT32)(OMCI_ME_TYPE_STANDARD);
    gMibThresholdData2TableInfo.ActionType = (UINT32)(OMCI_ME_ACTION_CREATE | OMCI_ME_ACTION_DELETE | OMCI_ME_ACTION_SET | OMCI_ME_ACTION_GET);
    gMibThresholdData2TableInfo.pAttributes = &(gMibThresholdData2AttrInfo[0]);

	gMibThresholdData2TableInfo.attrNum = MIB_TABLE_THRESHOLDDATA2_ATTR_NUM;
	gMibThresholdData2TableInfo.entrySize = sizeof(MIB_TABLE_THRESHOLDDATA2_T);
	gMibThresholdData2TableInfo.pDefaultRow = &gMibThresholdData2DefRow;

    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Name = "EntityId";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE8_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue8";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE9_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue9";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE10_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue10";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE11_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue11";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE12_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue12";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE13_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue13";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE14_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdValue14";

    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Entity ID";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE8_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 8";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE9_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 9";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE10_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 10";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE11_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 11";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE12_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 12";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE13_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 13";
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE14_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "threshod value 14";

    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE8_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE9_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE10_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE11_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE12_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE13_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE14_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;

    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE8_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE9_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE10_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE11_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE12_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE13_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE14_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;

    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = TRUE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE8_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE9_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE10_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE11_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE12_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE13_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE14_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;

    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE8_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE9_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE10_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE11_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE12_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE13_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE14_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;

    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE8_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE9_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE10_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE11_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE12_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE13_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE14_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;

    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE8_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE9_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE10_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE11_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE12_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE13_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE14_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;

    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE8_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE9_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE10_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE11_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE12_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE13_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE14_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;

    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE8_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE9_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE10_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE11_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE12_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE13_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibThresholdData2AttrInfo[MIB_TABLE_THRESHOLDDATA2_THRESHOLDVALUE14_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;

    memset(&(gMibThresholdData2DefRow.EntityId), 0x00, sizeof(gMibThresholdData2DefRow.EntityId));
    memset(&(gMibThresholdData2DefRow.ThresholdValue8), 0x00, sizeof(gMibThresholdData2DefRow.ThresholdValue8));
    memset(&(gMibThresholdData2DefRow.ThresholdValue9), 0x00, sizeof(gMibThresholdData2DefRow.ThresholdValue9));
    memset(&(gMibThresholdData2DefRow.ThresholdValue10), 0x00, sizeof(gMibThresholdData2DefRow.ThresholdValue10));
    memset(&(gMibThresholdData2DefRow.ThresholdValue11), 0x00, sizeof(gMibThresholdData2DefRow.ThresholdValue11));
    memset(&(gMibThresholdData2DefRow.ThresholdValue12), 0x00, sizeof(gMibThresholdData2DefRow.ThresholdValue12));
    memset(&(gMibThresholdData2DefRow.ThresholdValue13), 0x00, sizeof(gMibThresholdData2DefRow.ThresholdValue13));
    memset(&(gMibThresholdData2DefRow.ThresholdValue14), 0x00, sizeof(gMibThresholdData2DefRow.ThresholdValue14));

    memset(&gMibThresholdData2Oper, 0x0, sizeof(MIB_TABLE_OPER_T));
    gMibThresholdData2Oper.meOperDrvCfg = ThresholdData2DrvCfg;
    gMibThresholdData2Oper.meOperConnCheck = NULL;
    gMibThresholdData2Oper.meOperDump = omci_mib_oper_dump_default_handler;
	gMibThresholdData2Oper.meOperConnCfg = NULL;
	MIB_TABLE_THRESHOLDDATA2_INDEX = tableId;

    MIB_InfoRegister(tableId, &gMibThresholdData2TableInfo, &gMibThresholdData2Oper);

    return GOS_OK;
}
